package com.ruoyi.framework.web.service;

import com.ruoyi.common.core.domain.DTO.ComboConfigVO;
import com.ruoyi.common.core.domain.DTO.InsertComboConfigBO;
import com.ruoyi.common.core.domain.DTO.SelectComboConfigListBO;
import com.ruoyi.common.core.domain.DTO.UpdateComboConfigBO;
import com.ruoyi.common.core.domain.entity.ComboConfig;
import com.ruoyi.system.mapper.ComboConfigMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Slf4j
@Component
@Transactional
public class ComboConfigService {
    @Autowired
    private ComboConfigMapper comboConfigMapper;
    public void insertComboConfig(InsertComboConfigBO insertComboConfigBO) {
        ComboConfig comboConfig = new ComboConfig();
        BeanUtils.copyProperties(insertComboConfigBO, comboConfig);
        comboConfigMapper.insertComboConfig(comboConfig);
    }

    public void updateComboConfig(UpdateComboConfigBO updateComboConfigBO) {
        ComboConfig comboConfig = new ComboConfig();
        BeanUtils.copyProperties(updateComboConfigBO, comboConfig);
        comboConfigMapper.updateComboConfig(comboConfig);
    }

    public List<ComboConfigVO> selectComboConfigList(SelectComboConfigListBO selectComboConfigListBO) {
        ComboConfig comboConfig = new ComboConfig();
        BeanUtils.copyProperties(selectComboConfigListBO, comboConfig);
        return comboConfigMapper.selectComboConfigList(comboConfig);
    }

    public ComboConfigVO selectComboConfigById(Long id) {
        return comboConfigMapper.selectComboConfigById(id);
    }
}
